package geez.widget;

import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.CheckBox;

public class GCheckBox extends CheckBox implements GClickable, GFocusable {

    public GCheckBox() {
    }

    public GCheckBox(String label) {
        super(label);
    }

    public GCheckBox(String label, boolean asHTML) {
        super(label, asHTML);
    }

    public GCheckBox(Element elem) {
        super(elem);
    }

    public GCheckBox id(String id) {
        Geez.withNameAndId(this, id);
        return this;
    }

    public GCheckBox css(String cssClass, String... optionalClasses) {
        Geez.withStyle(this, cssClass, optionalClasses);
        return this;
    }

    public GCheckBox enable() {
        setEnabled(true);
        return this;
    }

    public GCheckBox disable() {
        setEnabled(false);
        return this;
    }

    public GCheckBox show() {
        setVisible(true);
        return this;
    }

    public GCheckBox hide() {
        setVisible(false);
        return this;
    }

    public GCheckBox checked() {
        setChecked(true);
        return this;
    }

    public GCheckBox unChecked() {
        setChecked(false);
        return this;
    }

    public GCheckBox tabIndex(int index) {
        setTabIndex(index);
        return this;
    }

    public GCheckBox add(ClickHandler handler) {
        addClickHandler(handler);
        return this;
    }

    public GCheckBox add(FocusHandler handler) {
        addFocusHandler(handler);
        return this;
    }

    public GCheckBox add(BlurHandler handler) {
        addBlurHandler(handler);
        return this;
    }

    public GCheckBox focus() {
        setFocus(true);
        return this;
    }
}
